package cn.bone.ou.vote.controller;

import cn.bone.base.bean.CommonResult;
import cn.bone.ou.vote.param.VoteParam;
import cn.bone.ou.vote.service.IVoteService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

@RequestMapping("/ou/vote")
@RestController
public class VoteController {

    @Resource
    private IVoteService voteService;

    @RequestMapping("/add")
    public CommonResult add(@Valid VoteParam.AddParam param){
        return voteService.add(param);
    }

    @RequestMapping("/modify")
    public CommonResult modify(@Valid VoteParam.ModifyParam param){
        return voteService.modify(param);
    }

    @RequestMapping("/list")
    public CommonResult list(@Valid VoteParam.ListParam param){
        return voteService.list(param);
    }

    @RequestMapping("/publish")
    public CommonResult publish(@Valid VoteParam.PublishParam param){
        return voteService.publish(param);
    }

    @RequestMapping("/unpublish")
    public CommonResult unpublish(@Valid VoteParam.UnpublishParam param){
        return voteService.unpublish(param);
    }

    @RequestMapping("/stop")
    public CommonResult stop(@Valid VoteParam.StopParam param){
        return voteService.stop(param);
    }

    @RequestMapping("/detail")
    public CommonResult detail(@Valid VoteParam.DetailParam param){
        return voteService.detail(param);
    }

    @RequestMapping("/delete")
    public CommonResult delete(@Valid VoteParam.DeleteParam param){
        return voteService.delete(param);
    }

    /**结果统计*/
    @RequestMapping("/resultDetail")
    public CommonResult resultDetail(@Valid VoteParam.ResultDetailParam param){
        return voteService.resultDetail(param);
    }

    /**全部投票*/
    @RequestMapping("/memberDetail")
    public CommonResult memberDetail(@Valid VoteParam.MemberDetailParam param){
        return voteService.memberDetail(param);
    }

    /**用户投票详情*/
    @RequestMapping("/memberVoteDetail")
    public CommonResult memberVoteDetail(@Valid VoteParam.MemberVoteDetailParam param){
        return voteService.memberVoteDetail(param);
    }
}
